<?php 
/*错误处理句柄*/
function error_handler_old($errno, $errstr, $errfile, $errline)
{
    if (!(error_reporting() & $errno)) {
        // This error code is not included in error_reporting
        return;
    }

    $errorLog = "";
    switch ($errno) {
    case E_USER_ERROR:
        $errorLog .= "<b>My ERROR</b> [$errno] $errstr<br />\n";
        $errorLog .= "  Fatal error on line $errline in file $errfile";
        $errorLog .= ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n";
        $errorLog .= "Aborting...<br />\n";
        // exit(1);
        break;

    case E_USER_WARNING:
        $errorLog .= "<b>My WARNING</b> [$errno] $errstr<br />\n";
        break;

    case E_USER_NOTICE:
        $errorLog .= "<b>My NOTICE</b> [$errno] $errstr<br />\n";
        break;

    default:
        $errorLog .= "Unknown error type: [$errno] $errstr<br />\n";
        break;
    }
   	file_put_contents("error.log", $errorLog,FILE_APPEND);

    /* Don't execute PHP internal error handler */
    return true;
}

set_error_handler("error_handler_old");